package com.spring.Entity;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * Created by Arabira on 2016/8/15.
 */
@Entity
@Table(name = "log", schema = "contract")
public class LogEntity {
    private int id;
    private String userName;
    private String userId;
    private String ip;
    private Timestamp functionTime;
    private String domain;
    private String operation;

    @Id
    @Column(name = "id")
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "userName")
    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    @Basic
    @Column(name = "userID")
    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    @Basic
    @Column(name = "IP")
    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    @Basic
    @Column(name = "functionTime")
    public Timestamp getFunctionTime() {
        return functionTime;
    }

    public void setFunctionTime(Timestamp functionTime) {
        this.functionTime = functionTime;
    }

    @Basic
    @Column(name = "domain")
    public String getDomain() {
        return domain;
    }

    public void setDomain(String domain) {
        this.domain = domain;
    }

    @Basic
    @Column(name = "operation")
    public String getOperation() {
        return operation;
    }

    public void setOperation(String operation) {
        this.operation = operation;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        LogEntity logEntity = (LogEntity) o;

        if (id != logEntity.id) return false;
        if (userName != null ? !userName.equals(logEntity.userName) : logEntity.userName != null) return false;
        if (userId != null ? !userId.equals(logEntity.userId) : logEntity.userId != null) return false;
        if (ip != null ? !ip.equals(logEntity.ip) : logEntity.ip != null) return false;
        if (functionTime != null ? !functionTime.equals(logEntity.functionTime) : logEntity.functionTime != null)
            return false;
        if (domain != null ? !domain.equals(logEntity.domain) : logEntity.domain != null) return false;
        if (operation != null ? !operation.equals(logEntity.operation) : logEntity.operation != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (userName != null ? userName.hashCode() : 0);
        result = 31 * result + (userId != null ? userId.hashCode() : 0);
        result = 31 * result + (ip != null ? ip.hashCode() : 0);
        result = 31 * result + (functionTime != null ? functionTime.hashCode() : 0);
        result = 31 * result + (domain != null ? domain.hashCode() : 0);
        result = 31 * result + (operation != null ? operation.hashCode() : 0);
        return result;
    }
}
